Creating point-in-time copies of data, referred to as snapshots, is one of the data protection techniques used to protect data stored in a storage server. A snapshot is a record of data stored in a storage system at a selected moment in time. A snapshot may be used to recover an earlier version of the data in the event a current version becomes corrupted, or may be copied to another storage device to provide a backup copy of the data, for example. Snapshots are commonly taken at scheduled intervals, such as once or twice an hour, for example, in order to provide maximum protection to the storage system. The time between scheduled snapshots is typically 30-60 minutes, for example. A client may request that scheduled snapshots be performed more or less often. Snapshots may also be initiated manually.
Snapshots algorithms are also typically performed prior to writing to a data block in response to a write request, to preserve the current data in the respective block. After a scheduled snapshot is performed, modification to the protected data in response to a write request, for example, does not take place until the original data to be modified is preserved by copying the data.
Several snapshot algorithms may be used to preserve modified data. One algorithm is Copy on First Write (“COFW”). Another is Redirect on Write (“ROW). In COFW, on each first write to a data block, the current data stored in the block is copied from the primary volume to a snapshot volume. After copying the data in a respective data block to the snapshot volume, the write operation is performed on the block in the primary volume. A point-in-time image of the data may be recreated by the combination of the primary volume and the snapshot volume or volumes that have been created. Only the first write to a block requires copying of the current data to a snapshot volume. Write I/Os after the first change to a block are performed on the source volume. After the snapshot is created, all subsequent read I/Os are performed on the primary volume. Write input/output (“I/O”) after the first change to a block are also performed on the source volume. (See, for example, Weijun Xiao, Yinan Liu, and Qing Yang “Implementation and Performance Evaluation of Two Snapshot Methods on iSCSI Target Storages,” Target Storages, Proc. 14th NASA Goddard/23rd Conf. Mass Storage Systems and Technologies (2006) (“Xiao”).
FIG. 1 is a Timeline 10 of an example of a COFW procedure. The Timeline 10 shows a snapshot period between scheduled snapshots SNAP 0 and SNAP 1. Two blocks 1, 2 of a portion of a primary storage device 12 are shown. Block 1 includes data A and Block 2 includes data B. At the time of SNAP 0, a snapshot volume SV(0) is created in storage for copies on first writes to respective data blocks in the primary storage, prior to SNAP 1.
At some time after SNAP 0 and before SNAP 1, a write request is received. In this example, the write requests is to write data E to Block 1. This is the first write to Block 1. After the write request is received and prior to performing the write, data A is copied from Block 1 in the primary storage 12 into SV(0). Only after data A is copied to the snapshot volume, the data E is written to Block 1 in the primary storage 12, as shown in FIG. 1. Data Block 2 is not changed in this example.
When SNAP 1 is performed, a new snapshot volume SV(1) is created in scheduled snapshot to store data prior to first writes to respective data blocks in the primary storage 12, between SNAP 1 and the next scheduled snapshot (SNAP 2, which is not shown). SV(0) is available for retrieval at any time if needed to recreate the primary storage 12 at a point-in-time, the conjunction with the current primary storages. Multiple snapshot volumes may need to be retrieved to recreate the primary storage at a time in the past, after multiple snapshots have been taken.
Another example of a snapshot procedure is described in U.S. Pat. No. 7,165,145, which is assigned to the assignee of the present invention and is incorporated by reference herein.
As described above, COFW requires at least three (3) I/O operations upon the first write to a block: 1) reading the data in the respective block from the primary volume; 2) writing the read data from the respective block to the snapshot volume; and 3) writing the new data in the primary volume. Writing metadata to the snapshot volume may be a fourth step. These I/O operations delay the desired write to the primary resource, which may negatively impact application performance. To overcome this, one can perform a redirect-on-write (“ROW”), which leaves the original block in the primary volume intact and the new write operation is performed on the snapshot volume. This eliminates the extra I/O operations of the COFW method. After the snapshot, all subsequent write I/Os are performed on the snapshot volume while read I/Os may be from the primary volume or the snapshot volume, depending on whether the block has been changed since the snapshot. The point-in-time image of the data at the time of a snapshot is the primary volume itself since the primary volume has been read-only since the time of the snapshot. The source volume will be updated at a later time, by copying data from the snapshot volume. (See, for example, Xiao, et al.).
Another example of a snapshot procedure is described in U.S. Pat. No. 7,165,145, which is assigned to the assignee of the present invention and is incorporated by reference herein.